. Free 'nprefix', closing a memory leak. Spaced out the code a bit to make
authorJeff Garzik <jgarzik@src.gnome.org>
Thu, 21 Jan 1999 00:37:48 +0000 (00:37 +0000)
committerJeff Garzik <jgarzik@src.gnome.org>
Thu, 21 Jan 1999 00:37:48 +0000 (00:37 +0000)
.
        * gtk/gtkcombo.c (gtk_combo_entry_key_press):
        Free 'nprefix', closing a memory leak.
        Spaced out the code a bit to make it more readable.

        * gtk/gtkhbox.[ch] (gtk_hbox_new),
          gtk/gtkvbox.[ch] (gtk_vbox_new):
        Change 'homogenous' arg from gint to gboolean.

        * gtk/gtktogglebutton.[ch]:
        New function gtk_toggle_button_get_active().

14 files changed:
ChangeLog
ChangeLog.pre-2-0
ChangeLog.pre-2-10
ChangeLog.pre-2-2
ChangeLog.pre-2-4
ChangeLog.pre-2-6
ChangeLog.pre-2-8
gtk/gtkcombo.c
gtk/gtkhbox.c
gtk/gtkhbox.h
gtk/gtktogglebutton.c
gtk/gtktogglebutton.h
gtk/gtkvbox.c
gtk/gtkvbox.h

index 63d8f8766f04cc4c8c2d2d46978aeefb66dbb5b5..48d68cf5e46be5960504c3481e6241177795027b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+1999-01-20  Jeff Garzik  <jgarzik@pobox.com>
+
+       * gtk/gtkcombo.c (gtk_combo_entry_key_press):
+       Free 'nprefix', closing a memory leak.
+       Spaced out the code a bit to make it more readable.
+
+       * gtk/gtkhbox.[ch] (gtk_hbox_new),
+         gtk/gtkvbox.[ch] (gtk_vbox_new):
+       Change 'homogenous' arg from gint to gboolean.
+
+       * gtk/gtktogglebutton.[ch]:
+       New function gtk_toggle_button_get_active().
+
 1999-01-20  Federico Mena Quintero  <federico@nuclecu.unam.mx>
 
        * gtk/gtkdnd.c (gtk_drag_get_event_action): Allow button 2 to act
index 63d8f8766f04cc4c8c2d2d46978aeefb66dbb5b5..48d68cf5e46be5960504c3481e6241177795027b 100644 (file)
@@ -1,3 +1,16 @@
+1999-01-20  Jeff Garzik  <jgarzik@pobox.com>
+
+       * gtk/gtkcombo.c (gtk_combo_entry_key_press):
+       Free 'nprefix', closing a memory leak.
+       Spaced out the code a bit to make it more readable.
+
+       * gtk/gtkhbox.[ch] (gtk_hbox_new),
+         gtk/gtkvbox.[ch] (gtk_vbox_new):
+       Change 'homogenous' arg from gint to gboolean.
+
+       * gtk/gtktogglebutton.[ch]:
+       New function gtk_toggle_button_get_active().
+
 1999-01-20  Federico Mena Quintero  <federico@nuclecu.unam.mx>
 
        * gtk/gtkdnd.c (gtk_drag_get_event_action): Allow button 2 to act
index 63d8f8766f04cc4c8c2d2d46978aeefb66dbb5b5..48d68cf5e46be5960504c3481e6241177795027b 100644 (file)
@@ -1,3 +1,16 @@
+1999-01-20  Jeff Garzik  <jgarzik@pobox.com>
+
+       * gtk/gtkcombo.c (gtk_combo_entry_key_press):
+       Free 'nprefix', closing a memory leak.
+       Spaced out the code a bit to make it more readable.
+
+       * gtk/gtkhbox.[ch] (gtk_hbox_new),
+         gtk/gtkvbox.[ch] (gtk_vbox_new):
+       Change 'homogenous' arg from gint to gboolean.
+
+       * gtk/gtktogglebutton.[ch]:
+       New function gtk_toggle_button_get_active().
+
 1999-01-20  Federico Mena Quintero  <federico@nuclecu.unam.mx>
 
        * gtk/gtkdnd.c (gtk_drag_get_event_action): Allow button 2 to act
index 63d8f8766f04cc4c8c2d2d46978aeefb66dbb5b5..48d68cf5e46be5960504c3481e6241177795027b 100644 (file)
@@ -1,3 +1,16 @@
+1999-01-20  Jeff Garzik  <jgarzik@pobox.com>
+
+       * gtk/gtkcombo.c (gtk_combo_entry_key_press):
+       Free 'nprefix', closing a memory leak.
+       Spaced out the code a bit to make it more readable.
+
+       * gtk/gtkhbox.[ch] (gtk_hbox_new),
+         gtk/gtkvbox.[ch] (gtk_vbox_new):
+       Change 'homogenous' arg from gint to gboolean.
+
+       * gtk/gtktogglebutton.[ch]:
+       New function gtk_toggle_button_get_active().
+
 1999-01-20  Federico Mena Quintero  <federico@nuclecu.unam.mx>
 
        * gtk/gtkdnd.c (gtk_drag_get_event_action): Allow button 2 to act
index 63d8f8766f04cc4c8c2d2d46978aeefb66dbb5b5..48d68cf5e46be5960504c3481e6241177795027b 100644 (file)
@@ -1,3 +1,16 @@
+1999-01-20  Jeff Garzik  <jgarzik@pobox.com>
+
+       * gtk/gtkcombo.c (gtk_combo_entry_key_press):
+       Free 'nprefix', closing a memory leak.
+       Spaced out the code a bit to make it more readable.
+
+       * gtk/gtkhbox.[ch] (gtk_hbox_new),
+         gtk/gtkvbox.[ch] (gtk_vbox_new):
+       Change 'homogenous' arg from gint to gboolean.
+
+       * gtk/gtktogglebutton.[ch]:
+       New function gtk_toggle_button_get_active().
+
 1999-01-20  Federico Mena Quintero  <federico@nuclecu.unam.mx>
 
        * gtk/gtkdnd.c (gtk_drag_get_event_action): Allow button 2 to act
index 63d8f8766f04cc4c8c2d2d46978aeefb66dbb5b5..48d68cf5e46be5960504c3481e6241177795027b 100644 (file)
@@ -1,3 +1,16 @@
+1999-01-20  Jeff Garzik  <jgarzik@pobox.com>
+
+       * gtk/gtkcombo.c (gtk_combo_entry_key_press):
+       Free 'nprefix', closing a memory leak.
+       Spaced out the code a bit to make it more readable.
+
+       * gtk/gtkhbox.[ch] (gtk_hbox_new),
+         gtk/gtkvbox.[ch] (gtk_vbox_new):
+       Change 'homogenous' arg from gint to gboolean.
+
+       * gtk/gtktogglebutton.[ch]:
+       New function gtk_toggle_button_get_active().
+
 1999-01-20  Federico Mena Quintero  <federico@nuclecu.unam.mx>
 
        * gtk/gtkdnd.c (gtk_drag_get_event_action): Allow button 2 to act
index 63d8f8766f04cc4c8c2d2d46978aeefb66dbb5b5..48d68cf5e46be5960504c3481e6241177795027b 100644 (file)
@@ -1,3 +1,16 @@
+1999-01-20  Jeff Garzik  <jgarzik@pobox.com>
+
+       * gtk/gtkcombo.c (gtk_combo_entry_key_press):
+       Free 'nprefix', closing a memory leak.
+       Spaced out the code a bit to make it more readable.
+
+       * gtk/gtkhbox.[ch] (gtk_hbox_new),
+         gtk/gtkvbox.[ch] (gtk_vbox_new):
+       Change 'homogenous' arg from gint to gboolean.
+
+       * gtk/gtktogglebutton.[ch]:
+       New function gtk_toggle_button_get_active().
+
 1999-01-20  Federico Mena Quintero  <federico@nuclecu.unam.mx>
 
        * gtk/gtkdnd.c (gtk_drag_get_event_action): Allow button 2 to act
index 8d29d206f727e297d77524b4bc8bedd78d606d97..6857279e95812493fb464848e3b8d017be796090 100644 (file)
@@ -125,27 +125,37 @@ gtk_combo_entry_key_press (GtkEntry * entry, GdkEventKey * event, GtkCombo * com
     gchar* nprefix = NULL;
     gint pos;
 
-    if ( !GTK_LIST(combo->list)->children )
+    if ( !GTK_LIST (combo->list)->children )
       return FALSE;
     
     gtk_signal_emit_stop_by_name (GTK_OBJECT (entry), "key_press_event");
-    cmpl = g_completion_new((GCompletionFunc)gtk_combo_func);
-    g_completion_add_items(cmpl, GTK_LIST(combo->list)->children);
-    pos = GTK_EDITABLE(entry)->current_pos;
-    prefix = gtk_editable_get_chars(GTK_EDITABLE(entry), 0, pos);
+
+    cmpl = g_completion_new ((GCompletionFunc)gtk_combo_func);
+    g_completion_add_items (cmpl, GTK_LIST (combo->list)->children);
+
+    pos = GTK_EDITABLE (entry)->current_pos;
+    prefix = gtk_editable_get_chars (GTK_EDITABLE (entry), 0, pos);
+
     g_completion_complete(cmpl, prefix, &nprefix);
-    if (nprefix && strlen(nprefix) > strlen(prefix)) 
+
+    if (nprefix && strlen (nprefix) > strlen (prefix)) 
       {
-       gtk_editable_insert_text(GTK_EDITABLE(entry), nprefix+pos, 
-                                strlen(nprefix)-strlen(prefix), &pos);
-       GTK_EDITABLE(entry)->current_pos = pos;
+       gtk_editable_insert_text (GTK_EDITABLE (entry), nprefix + pos, 
+                                strlen (nprefix) - strlen (prefix), &pos);
+       GTK_EDITABLE (entry)->current_pos = pos;
     }
-    g_free(prefix);
-    g_completion_free(cmpl);
+
+    if (nprefix)
+      g_free (nprefix);
+    g_free (prefix);
+    g_completion_free (cmpl);
+
     return TRUE;
   }
+
   if (!combo->use_arrows || !GTK_LIST (combo->list)->children)
     return FALSE;
+
   li = g_list_find (GTK_LIST (combo->list)->children, gtk_combo_find (combo));
 
   if ((event->keyval == GDK_Up)
index 0c10550b822c681cf10706a72d37f55467134658..f705d9f563b01c5c33b7b928716a66dffa09fa22 100644 (file)
@@ -69,7 +69,7 @@ gtk_hbox_init (GtkHBox *hbox)
 }
 
 GtkWidget*
-gtk_hbox_new (gint homogeneous,
+gtk_hbox_new (gboolean homogeneous,
              gint spacing)
 {
   GtkHBox *hbox;
index 5a326133d7017de07717817cf21c1890cf74b09f..0c346105799dbc09f118f97e2cfd6383559af3d1 100644 (file)
@@ -51,7 +51,7 @@ struct _GtkHBoxClass
 
 
 GtkType           gtk_hbox_get_type (void);
-GtkWidget* gtk_hbox_new             (gint homogeneous,
+GtkWidget* gtk_hbox_new             (gboolean homogeneous,
                              gint spacing);
 
 
index 732526cce218f15b1d9a1df9a6eaf623b10f4921..c5fbdb373db5cfb4e9d4e64cb19c38682e10b339 100644 (file)
@@ -267,6 +267,7 @@ gtk_toggle_button_set_mode (GtkToggleButton *toggle_button,
     }
 }
 
+
 void
 gtk_toggle_button_set_active (GtkToggleButton *toggle_button,
                              gboolean         is_active)
@@ -280,6 +281,17 @@ gtk_toggle_button_set_active (GtkToggleButton *toggle_button,
     gtk_button_clicked (GTK_BUTTON (toggle_button));
 }
 
+
+gboolean
+gtk_toggle_button_get_active (GtkToggleButton *toggle_button)
+{
+  g_return_val_if_fail (toggle_button != NULL, FALSE);
+  g_return_val_if_fail (GTK_IS_TOGGLE_BUTTON (toggle_button), FALSE);
+
+  return (toggle_button->active) ? TRUE : FALSE;
+}
+
+
 void
 gtk_toggle_button_toggled (GtkToggleButton *toggle_button)
 {
index bdb2a6e69778bdd4ed6399cfc6b269ac20667b1b..156dfb7e3c6b15aed6a927a0325edf4927072c0d 100644 (file)
@@ -64,6 +64,7 @@ void       gtk_toggle_button_set_mode       (GtkToggleButton *toggle_button,
                                             gboolean         draw_indicator);
 void       gtk_toggle_button_set_active     (GtkToggleButton *toggle_button,
                                             gboolean         is_active);
+gboolean   gtk_toggle_button_get_active            (GtkToggleButton *toggle_button);
 void       gtk_toggle_button_toggled        (GtkToggleButton *toggle_button);
 
 
index cd48869cce3cbbc891e9332dfb833fbb71309b8f..a4b8d031f9719b1e1ea412d0a016109414a7ed77 100644 (file)
@@ -69,7 +69,7 @@ gtk_vbox_init (GtkVBox *vbox)
 }
 
 GtkWidget*
-gtk_vbox_new (gint homogeneous,
+gtk_vbox_new (gboolean homogeneous,
              gint spacing)
 {
   GtkVBox *vbox;
index ddebeadf9243a53f980bf606fac3ea93f9b725b7..2661df1baabc3be52a455ef702a0d334a8f87831 100644 (file)
@@ -51,7 +51,7 @@ struct _GtkVBoxClass
 
 
 GtkType           gtk_vbox_get_type (void);
-GtkWidget* gtk_vbox_new             (gint homogeneous,
+GtkWidget* gtk_vbox_new             (gboolean homogeneous,
                              gint spacing);